<?php
declare (strict_types = 1);

namespace app\common\model\mysql;

/**
 * @mixin \think\Model
 */
class SpecsValue extends BaseModel
{
    /**
     * 通过规格 ID 获取当前规格所欲属性
     *
     * @param int $specsId
     * @param string $field
     * @return SpecsValue[]|array|\think\Collection
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getNormalBySpecsId(int $specsId, $field = true)
    {
        $where = ['specs_id' => $specsId, 'status' => config('status.mysql.table_normal')];
        $res   = $this->where($where)->field($field)->select();
        return $res;
    }
}
